import Taro from "@tarojs/taro"
import { wechatCode2SessionV1 } from '@/service'


/**
 * 
 * @description 抖音小程序 静默登录
 */
const auth: AppConfigType['auth'] = async () => {
    const { code } = await Taro.login()
    const { accessToken } = await wechatCode2SessionV1({ code })
    Taro.setStorageSync('token', accessToken)
    return accessToken || false
}

export default auth